<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>显示隐藏</title>
</head>
<body>
    <button id="btn">隐藏</button><br>
    <img src="01.jpg" alt="" id="imgs" height="270px">

    <script>
        var btnObj = document.getElementById('btn')
        var imgObj = document.getElementById('imgs')
        btnObj.onclick = function(){
            if(btnObj.innerHTML === '隐藏'){
                imgObj.style.display = 'none';
                btnObj.innerHTML = '显示';
            }
            else{
                imgObj.style.display = 'block';
                btnObj.innerHTML = '隐藏'
            }
        }
    </script>
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
</body>
</html>